package com.coderman.domainservice.blogtopic.domain.convertor;

import com.coderman.domainservice.blogtopic.client.dto.BlogDTO;
import com.coderman.domainservice.blogtopic.domain.model.entity.BlogBO;
import com.coderman.domainservice.blogtopic.infrast.mapper.dataobject.BlogDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * Description:
 * date: 2021/3/29
 *
 * @author shenshuai
 * @version 1.0.0
 * @since JDK 1.8
 * 基于mapstrcut 实现数据模型转换
 * 这里放在领域层可以方便
 * dto->bo,bo->dto
 * do->bo,bo->do
 */
@Mapper
public interface BlogConvertor {
    BlogConvertor INSTANCE = Mappers.getMapper(BlogConvertor.class);
    /**
     * dto-->bo
     * @param blogDTO
     * @return
     */
    BlogBO dto2bo(BlogDTO blogDTO);

    /**
     * bo-->do
     * @param blogBO
     * @return
     */
    BlogDO bo2do(BlogBO blogBO);

    /**
     * do-->bo
     * @param blogDO
     * @return
     */
    BlogBO do2bo(BlogDO blogDO);
}
